package com.rooster.gateway.filter;

import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * @description:
 * @Author C_Y_J
 * @create 2021-03-30 14:30
 **/
@Component
public class AuthFilter implements GlobalFilter, Ordered {
    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        //进行业务逻辑判断，如果满足条件就放行
        return chain.filter(exchange);
    }

    /**
     * 过滤器排序，数值越小，越先执行
     *
     * @return
     */
    @Override
    public int getOrder() {
        return 0;
    }
}
